//
//  MyInformationHeadTableViewCell.m
//  LovingPartyBuilding
//
//  Created by 刘应平 on 17/5/2.
//  Copyright © 2017年 刘应平. All rights reserved.
//

#import "MyInformationHeadTableViewCell.h"

@implementation MyInformationHeadTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

/**  60  */
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self layoutUI];
    }
    return self;
}




#pragma mark - 界面
- (void)layoutUI{
    
    [self addSubview:self.nextImageView];
    [self addSubview:self.headImageView];
    self.nextImageView.sd_layout
    .topSpaceToView(self,15 * [UIScreen zj_screenHScale])
    .rightSpaceToView(self,15 * [UIScreen zj_screenWScale])
    .heightIs(20 * [UIScreen zj_screenHScale])
    .widthIs(15 * [UIScreen zj_screenWScale]);

    
    self.headImageView.sd_layout
    .topSpaceToView(self,5 * [UIScreen zj_screenHScale])
    .leftSpaceToView(self,20 * [UIScreen zj_screenWScale])
    .heightIs(50 * [UIScreen zj_screenHScale])
    .widthIs(50 * [UIScreen zj_screenHScale]);

    UIView *under = [UIView new];
    under.backgroundColor = [UIColor themeGrayColor];
    [self addSubview:under];
    under.sd_layout.leftEqualToView(self).bottomEqualToView(self).widthIs([UIScreen zj_screenWith]).heightIs(1.5);

}


#pragma mark - 私有方法


- (void)setModel:(MyInforHeadModel *)model{
    _model = model;
    [self.headImageView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",BASEIMAGEURL,model.head]] placeholderImage:PlaceholderHeaderImage];
}


#pragma mark - getter
- (UIImageView *)nextImageView{
    if (!_nextImageView) {
        _nextImageView = [UIImageView new];
        _nextImageView.contentMode = UIViewContentModeRight;
        _nextImageView.image = [UIImage imageNamed:@"mine_list_pop"];
    }
    return _nextImageView;
    
}

- (UIImageView *)headImageView{
    if (!_headImageView) {
        _headImageView = [UIImageView new];
        _headImageView.layer.cornerRadius = 25 * [UIScreen zj_screenHScale];
        _headImageView.layer.masksToBounds = YES;
       
    }
    return _headImageView;
    
}
@end
